﻿<UserControl x:Class="EpiDashboard.TwoByTwoTableControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:dg="http://schemas.microsoft.com/wpf/2008/toolkit"
    xmlns:EpiDashboard="clr-namespace:EpiDashboard"
    Background="#CCFFFFFF">
    <Grid>
        <GroupBox Margin="0,0,5,0">
            <GroupBox.Header>
                <TextBlock FontWeight="Bold">2x2 Tables</TextBlock>
            </GroupBox.Header>
            <Grid>
                <StackPanel x:Name="pnlStatus" Height="28" Width="Auto" Background="Tomato" Visibility="Collapsed" VerticalAlignment="Top" Margin="0, 52, 0, 2" >
                    <StackPanel x:Name="pnlStatusTop" Height="2" Width="Auto" Background="Red"/>
                    <TextBlock x:Name="txtStatus" Text="Error: Exception occurred." TextWrapping="WrapWithOverflow" MaxWidth="530" Margin="5,5,5,5" HorizontalAlignment="Left" />
                </StackPanel>

                <StackPanel x:Name="pnlMainContent" Background="White" HorizontalAlignment="Left" VerticalAlignment="Top">
                    <StackPanel.ContextMenu>
                        <ContextMenu>
                            <MenuItem x:Name="mnuSave" Header="Save as image..."/>
                            <MenuItem x:Name="mnuCopyImage" Header="Copy image to clipboard"/>
                            <MenuItem x:Name="mnuCopyData" Header="Copy data to clipboard"/>
                            <MenuItem x:Name="mnuSendDataToHTML" Header="Send data to web browser">
                                <MenuItem.Icon>
                                    <Image Source="Images/saveHTML.png" />
                                </MenuItem.Icon>
                            </MenuItem>
                            <MenuItem x:Name="mnuPrint" Header="Print..."/>
                            <Separator/>
                            <MenuItem x:Name="mnuSendToBack" Header="Send gadget to back"/>
                            <MenuItem x:Name="mnuRefresh" Header="Refresh this gadget">
                                <MenuItem.Icon>
                                    <Image Source="Images/refresh1.png" />
                                </MenuItem.Icon>
                            </MenuItem>
                            <MenuItem x:Name="mnuClose" Header="Close this gadget"/>
                        </ContextMenu>
                    </StackPanel.ContextMenu>
                    <Grid>
                        <EpiDashboard:WaitCursor x:Name="waitCursor" Width="25" Height="25" Visibility="Collapsed" StackPanel.ZIndex="99" HorizontalAlignment="Right" VerticalAlignment="Top"/>
                    </Grid>
                    <dg:DataGrid x:Name="dgResults" Margin="0,40,0,0" Visibility="Collapsed"/>
                    <StackPanel Name="pnlContent" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="Collapsed">
                        <TextBlock Name="txtExposure" Visibility="Collapsed" FontWeight="Bold" Width="120"  Margin="2, 0, 2, 0" VerticalAlignment="Center" HorizontalAlignment="Center" Text="Vanilla" Grid.Row="1" Grid.Column="0"></TextBlock>
                        <Grid Name="grdTables" HorizontalAlignment="Center" Margin="-100,10,10,10" Visibility="Visible">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="20"/>
                                <RowDefinition Height="30"/>
                                <RowDefinition Height="70"/>
                                <RowDefinition Height="70"/>
                                <RowDefinition Height="70"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>

                            <Rectangle Grid.Row="1" Grid.Column="1" Stroke="Black" Fill="{x:Static SystemColors.MenuHighlightBrush}"/>
                            <Rectangle Grid.Row="1" Grid.Column="2" Stroke="Black" Fill="{x:Static SystemColors.MenuHighlightBrush}"/>
                            <Rectangle Grid.Row="1" Grid.Column="3" Stroke="Black" Fill="{x:Static SystemColors.MenuHighlightBrush}"/>
                            <Rectangle Grid.Row="2" Grid.Column="0" Stroke="Black" Fill="{x:Static SystemColors.MenuHighlightBrush}"/>
                            <Rectangle Grid.Row="2" Grid.Column="1" Stroke="Black"/>
                            <Rectangle Grid.Row="2" Grid.Column="2" Stroke="Black"/>
                            <Rectangle Grid.Row="2" Grid.Column="3" Stroke="Black"/>
                            <Rectangle Grid.Row="3" Grid.Column="0" Stroke="Black" Fill="{x:Static SystemColors.MenuHighlightBrush}"/>
                            <Rectangle Grid.Row="3" Grid.Column="1" Stroke="Black"/>
                            <Rectangle Grid.Row="3" Grid.Column="2" Stroke="Black"/>
                            <Rectangle Grid.Row="3" Grid.Column="3" Stroke="Black"/>
                            <Rectangle Grid.Row="4" Grid.Column="0" Stroke="Black" Fill="{x:Static SystemColors.MenuHighlightBrush}"/>
                            <Rectangle Grid.Row="4" Grid.Column="1" Stroke="Black"/>
                            <Rectangle Grid.Row="4" Grid.Column="2" Stroke="Black"/>
                            <Rectangle Grid.Row="4" Grid.Column="3" Stroke="Black"/>

                            <TextBlock FontWeight="Bold" Name="txtOutcome" HorizontalAlignment="Center" Text="ILL" Grid.ColumnSpan="4" Grid.Row="0" Grid.Column="0"></TextBlock>

                            <TextBlock x:Name="outcomeYes" FontWeight="Bold" Foreground="White" Margin="2, 0, 2, 0" VerticalAlignment="Center" HorizontalAlignment="Center" Text="Yes" Grid.Row="1" Grid.Column="1"></TextBlock>
                            <TextBlock x:Name="outcomeNo" FontWeight="Bold" Foreground="White" Margin="2, 0, 2, 0" VerticalAlignment="Center" HorizontalAlignment="Center" Text="No" Grid.Row="1" Grid.Column="2"></TextBlock>
                            <TextBlock FontWeight="Bold" Foreground="White" Margin="2, 0, 2, 0" VerticalAlignment="Center" HorizontalAlignment="Center" Text="Total" Grid.Row="1" Grid.Column="3"></TextBlock>

                            <StackPanel Margin="2, 0, 2, 0" VerticalAlignment="Center" Grid.Row="2" Grid.Column="0">
                                <TextBlock x:Name="exposureYes" FontWeight="Bold" Foreground="White" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="Yes"></TextBlock>
                                <TextBlock x:Name="tblockYesRowPercent" FontWeight="Bold" Foreground="White" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="Row %"></TextBlock>
                                <TextBlock x:Name="tblockYesColPercent" FontWeight="Bold" Foreground="White" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="Col %"></TextBlock>
                            </StackPanel>

                            <StackPanel Margin="2, 0, 2, 0" VerticalAlignment="Center" Grid.Row="3" Grid.Column="0">
                                <TextBlock x:Name="exposureNo" FontWeight="Bold" Foreground="White" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="No"></TextBlock>
                                <TextBlock x:Name="tblockNoRowPercent" FontWeight="Bold" Foreground="White" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="Row %"></TextBlock>
                                <TextBlock x:Name="tblockNoColPercent" FontWeight="Bold" Foreground="White" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="Col %"></TextBlock>
                            </StackPanel>

                            <StackPanel Margin="2, 0, 2, 0" VerticalAlignment="Center" Grid.Row="4" Grid.Column="0">
                                <TextBlock FontWeight="Bold" Foreground="White" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="Total"></TextBlock>
                                <TextBlock x:Name="tblockTotalRowPercent" FontWeight="Bold" Foreground="White" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="Row %"></TextBlock>
                                <TextBlock x:Name="tblockTotalColPercent" FontWeight="Bold" Foreground="White" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="Col %"></TextBlock>
                            </StackPanel>

                            <StackPanel Margin="2, 0, 2, 0" VerticalAlignment="Center" Grid.Row="2" Grid.Column="1">
                                <TextBlock Name="txtYesYesVal" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="46" FontSize="16" FontWeight="Bold" MinWidth="50" TextAlignment="Right" ></TextBlock>
                                <TextBlock Name="txtYesYesRow" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="61.3"></TextBlock>
                                <TextBlock Name="txtYesYesCol" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="100.0"></TextBlock>
                            </StackPanel>

                            <StackPanel Margin="2, 0, 2, 0" VerticalAlignment="Center" Grid.Row="3" Grid.Column="1">
                                <TextBlock Name="txtNoYesVal" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="46" FontSize="16" FontWeight="Bold" MinWidth="50" TextAlignment="Right"></TextBlock>
                                <TextBlock Name="txtNoYesRow" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="61.3"></TextBlock>
                                <TextBlock Name="txtNoYesCol" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="100.0"></TextBlock>
                            </StackPanel>

                            <StackPanel Margin="2, 0, 2, 0" VerticalAlignment="Center" Grid.Row="4" Grid.Column="1">
                                <TextBlock Name="txtTotalYesVal" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="46" FontSize="16" FontWeight="Bold" MinWidth="50" TextAlignment="Right"></TextBlock>
                                <TextBlock Name="txtTotalYesRow" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="61.3"></TextBlock>
                                <TextBlock Name="txtTotalYesCol" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="100.0"></TextBlock>
                            </StackPanel>

                            <StackPanel Margin="2, 0, 2, 0" VerticalAlignment="Center" Grid.Row="2" Grid.Column="2">
                                <TextBlock Name="txtYesNoVal" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="46" FontSize="16" FontWeight="Bold" MinWidth="50" TextAlignment="Right"></TextBlock>
                                <TextBlock Name="txtYesNoRow" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="61.3"></TextBlock>
                                <TextBlock Name="txtYesNoCol" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="100.0"></TextBlock>
                            </StackPanel>

                            <StackPanel Margin="2, 0, 2, 0" VerticalAlignment="Center" Grid.Row="3" Grid.Column="2">
                                <TextBlock Name="txtNoNoVal" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="46" FontSize="16" FontWeight="Bold" MinWidth="50" TextAlignment="Right"></TextBlock>
                                <TextBlock Name="txtNoNoRow" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="61.3"></TextBlock>
                                <TextBlock Name="txtNoNoCol" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="100.0"></TextBlock>
                            </StackPanel>

                            <StackPanel Margin="2, 0, 2, 0" VerticalAlignment="Center" Grid.Row="4" Grid.Column="2">
                                <TextBlock Name="txtTotalNoVal" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="46" FontSize="16" FontWeight="Bold" MinWidth="50" TextAlignment="Right"></TextBlock>
                                <TextBlock Name="txtTotalNoRow" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="61.3"></TextBlock>
                                <TextBlock Name="txtTotalNoCol" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="100.0"></TextBlock>
                            </StackPanel>

                            <StackPanel Margin="2, 0, 2, 0" VerticalAlignment="Center" Grid.Row="2" Grid.Column="3">
                                <TextBlock Name="txtYesTotalVal" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="46" FontSize="16" FontWeight="Bold" MinWidth="50" TextAlignment="Right"></TextBlock>
                                <TextBlock Name="txtYesTotalRow" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="61.3"></TextBlock>
                                <TextBlock Name="txtYesTotalCol" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="100.0"></TextBlock>
                            </StackPanel>

                            <StackPanel Margin="2, 0, 2, 0" VerticalAlignment="Center" Grid.Row="3" Grid.Column="3">
                                <TextBlock Name="txtNoTotalVal" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="46" FontSize="16" FontWeight="Bold" MinWidth="50" TextAlignment="Right"></TextBlock>
                                <TextBlock Name="txtNoTotalRow" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="61.3"></TextBlock>
                                <TextBlock Name="txtNoTotalCol" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="100.0"></TextBlock>
                            </StackPanel>

                            <StackPanel Margin="2, 0, 2, 0" VerticalAlignment="Center" Grid.Row="4" Grid.Column="3">
                                <TextBlock Name="txtTotalTotalVal" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="46" FontSize="16" FontWeight="Bold" MinWidth="50" TextAlignment="Right" ></TextBlock>
                                <TextBlock Name="txtTotalTotalRow" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="61.3"></TextBlock>
                                <TextBlock Name="txtTotalTotalCol" Margin="2, 2, 2, 2" VerticalAlignment="Center" HorizontalAlignment="Right" Text="100.0"></TextBlock>
                            </StackPanel>
                        </Grid>
                        <Grid Name="grdGraph" Width="300" Height="300" HorizontalAlignment="Center" Margin="0,10,0,0" Visibility="Visible">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="150"/>
                                <ColumnDefinition Width="150"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="150"/>
                                <RowDefinition Height="150"/>
                            </Grid.RowDefinitions>
                            <Rectangle Name="rctRed" Width="1" Height="1" Grid.Row="0" Grid.Column="0" Fill="Red" HorizontalAlignment="Right" VerticalAlignment="Bottom"/>
                            <Rectangle Name="rctOrange" Width="1" Height="1" Grid.Row="0" Grid.Column="1" Fill="Orange" HorizontalAlignment="Left" VerticalAlignment="Bottom"/>
                            <Rectangle Name="rctYellow" Width="1" Height="1" Grid.Row="1" Grid.Column="0" Fill="Yellow" HorizontalAlignment="Right" VerticalAlignment="Top"/>
                            <Rectangle Name="rctGreen" Width="1" Height="1" Grid.Row="1" Grid.Column="1" Fill="Green" HorizontalAlignment="Left" VerticalAlignment="Top"/>
                        </Grid>
                    </StackPanel>
                    <StackPanel Name="pnlAdvanced" HorizontalAlignment="Left" Margin="5,5,5,5" Visibility="Collapsed" Orientation="Horizontal">
                        <StackPanel Name="pnlParameters" HorizontalAlignment="Left" Margin="0" Visibility="Visible" Orientation="Vertical">
                        <StackPanel>
                            <TextBlock FontWeight="Bold" HorizontalAlignment="Center">Odds-based Parameters</TextBlock>
                            <Grid Name="grdParameters" HorizontalAlignment="Left" Margin="5,5,5,5">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="30"/>
                                    <RowDefinition Height="30"/>
                                    <RowDefinition Height="30"/>
                                    <RowDefinition Height="30"/>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="100"/>
                                    <ColumnDefinition Width="60"/>
                                    <ColumnDefinition Width="60"/>
                                    <ColumnDefinition Width="60"/>
                                </Grid.ColumnDefinitions>
                                <Rectangle Grid.Row="0" Grid.Column="1" Stroke="Black" Fill="{x:Static SystemColors.MenuHighlightBrush}"/>
                                <Rectangle Grid.Row="0" Grid.Column="2" Stroke="Black" Fill="{x:Static SystemColors.MenuHighlightBrush}"/>
                                <Rectangle Grid.Row="0" Grid.Column="3" Stroke="Black" Fill="{x:Static SystemColors.MenuHighlightBrush}"/>
                                <Rectangle Grid.Row="1" Grid.Column="0" Stroke="Black" Fill="{x:Static SystemColors.MenuHighlightBrush}"/>
                                <Rectangle Grid.Row="1" Grid.Column="1" Stroke="Black"/>
                                <Rectangle Grid.Row="1" Grid.Column="2" Stroke="Black"/>
                                <Rectangle Grid.Row="1" Grid.Column="3" Stroke="Black"/>
                                <Rectangle Grid.Row="2" Grid.Column="0" Stroke="Black" Fill="{x:Static SystemColors.MenuHighlightBrush}"/>
                                <Rectangle Grid.Row="2" Grid.Column="1" Stroke="Black"/>
                                <Rectangle Grid.Row="2" Grid.Column="2" Stroke="Black"/>
                                <Rectangle Grid.Row="2" Grid.Column="3" Stroke="Black"/>
                                <Rectangle Grid.Row="3" Grid.Column="0" Stroke="Black" Fill="{x:Static SystemColors.MenuHighlightBrush}"/>
                                <Rectangle Grid.Row="3" Grid.Column="1" Stroke="Black"/>
                                <Rectangle Grid.Row="3" Grid.Column="2" Stroke="Black"/>
                                <Rectangle Grid.Row="3" Grid.Column="3" Stroke="Black"/>

                                <TextBlock FontWeight="Bold" Foreground="White" Margin="6, 0, 6, 0" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Row="0" Grid.Column="1" Text="Estimate"/>
                                <TextBlock FontWeight="Bold" Foreground="White" Margin="6, 0, 6, 0" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Row="0" Grid.Column="2" Text="Lower"/>
                                <TextBlock FontWeight="Bold" Foreground="White" Margin="6, 0, 6, 0" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Row="0" Grid.Column="3" Text="Upper"/>

                                <TextBlock FontWeight="Bold" Foreground="White" Margin="6, 0, 6, 0" VerticalAlignment="Center" Grid.Row="1" Grid.Column="0" Text="Odds Ratio"/>
                                    <TextBlock FontWeight="Bold" Foreground="White" Margin="6, 0, 6, 0" VerticalAlignment="Center" Grid.Row="2" Grid.Column="0" Text="MLE Odds Ratio&#x0a;(Mid-P)"/>
                                    <TextBlock FontWeight="Bold" Foreground="White" Margin="6, 0, 6, 0" VerticalAlignment="Center" Grid.Row="3" Grid.Column="0" Text="Fisher-Exact"/>

                                <TextBlock Margin="6, 0, 6, 0" Name="txtOddsRatioEstimate" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="1" Grid.Column="1" />
                                <TextBlock Margin="6, 0, 6, 0" Name="txtOddsRatioLower" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="1" Grid.Column="2" />
                                <TextBlock Margin="6, 0, 6, 0" Name="txtOddsRatioUpper" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="1" Grid.Column="3" />

                                <TextBlock Margin="6, 0, 6, 0" Name="txtMidPEstimate" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="2" Grid.Column="1" />
                                <TextBlock Margin="6, 0, 6, 0" Name="txtMidPLower" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="2" Grid.Column="2" />
                                <TextBlock Margin="6, 0, 6, 0" Name="txtMidPUpper" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="2" Grid.Column="3" />

                                <TextBlock Margin="6, 0, 6, 0" Name="txtFisherEstimate" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="3" Grid.Column="1" />
                                <TextBlock Margin="6, 0, 6, 0" Name="txtFisherLower" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="3" Grid.Column="2" />
                                <TextBlock Margin="6, 0, 6, 0" Name="txtFisherUpper" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="3" Grid.Column="3" />
                            </Grid>
                        </StackPanel>
                            <StackPanel>
                                <TextBlock FontWeight="Bold" HorizontalAlignment="Center">Risk-based Parameters</TextBlock>
                                <Grid Name="grdRiskParameters" HorizontalAlignment="Left" Margin="5,5,5,5">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="30"/>
                                        <RowDefinition Height="30"/>
                                        <RowDefinition Height="30"/>
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="100"/>
                                        <ColumnDefinition Width="60"/>
                                        <ColumnDefinition Width="60"/>
                                        <ColumnDefinition Width="60"/>
                                    </Grid.ColumnDefinitions>
                                    <Rectangle Grid.Row="0" Grid.Column="1" Stroke="Black" Fill="{x:Static SystemColors.MenuHighlightBrush}"/>
                                    <Rectangle Grid.Row="0" Grid.Column="2" Stroke="Black" Fill="{x:Static SystemColors.MenuHighlightBrush}"/>
                                    <Rectangle Grid.Row="0" Grid.Column="3" Stroke="Black" Fill="{x:Static SystemColors.MenuHighlightBrush}"/>
                                    <Rectangle Grid.Row="1" Grid.Column="0" Stroke="Black" Fill="{x:Static SystemColors.MenuHighlightBrush}"/>
                                    <Rectangle Grid.Row="1" Grid.Column="1" Stroke="Black"/>
                                    <Rectangle Grid.Row="1" Grid.Column="2" Stroke="Black"/>
                                    <Rectangle Grid.Row="1" Grid.Column="3" Stroke="Black"/>
                                    <Rectangle Grid.Row="2" Grid.Column="0" Stroke="Black" Fill="{x:Static SystemColors.MenuHighlightBrush}"/>
                                    <Rectangle Grid.Row="2" Grid.Column="1" Stroke="Black"/>
                                    <Rectangle Grid.Row="2" Grid.Column="2" Stroke="Black"/>
                                    <Rectangle Grid.Row="2" Grid.Column="3" Stroke="Black"/>

                                    <TextBlock FontWeight="Bold" Foreground="White" Margin="6, 0, 6, 0" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Row="0" Grid.Column="1" Text="Estimate"/>
                                    <TextBlock FontWeight="Bold" Foreground="White" Margin="6, 0, 6, 0" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Row="0" Grid.Column="2" Text="Lower"/>
                                    <TextBlock FontWeight="Bold" Foreground="White" Margin="6, 0, 6, 0" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Row="0" Grid.Column="3" Text="Upper"/>

                                    <TextBlock FontWeight="Bold" Foreground="White" Margin="6, 0, 6, 0" VerticalAlignment="Center" Grid.Row="1" Grid.Column="0" Text="Risk Ratio"/>
                                    <TextBlock FontWeight="Bold" Foreground="White" Margin="6, 0, 6, 0" VerticalAlignment="Center" Grid.Row="2" Grid.Column="0" Text="Risk Difference"/>

                                    <TextBlock Margin="6, 0, 6, 0" Name="txtRiskRatioEstimate" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="1" Grid.Column="1" />
                                    <TextBlock Margin="6, 0, 6, 0" Name="txtRiskRatioLower" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="1" Grid.Column="2" />
                                    <TextBlock Margin="6, 0, 6, 0" Name="txtRiskRatioUpper" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="1" Grid.Column="3" />

                                    <TextBlock Margin="6, 0, 6, 0" Name="txtRiskDifferenceEstimate" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="2" Grid.Column="1" />
                                    <TextBlock Margin="6, 0, 6, 0" Name="txtRiskDifferenceLower" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="2" Grid.Column="2" />
                                    <TextBlock Margin="6, 0, 6, 0" Name="txtRiskDifferenceUpper" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="2" Grid.Column="3" />
                                </Grid>
                            </StackPanel>
                        </StackPanel>
                        <StackPanel Name="pnlTests" HorizontalAlignment="Left" Margin="0" Visibility="Visible" Orientation="Vertical">
                            <StackPanel>
                                <TextBlock FontWeight="Bold" HorizontalAlignment="Center">Statistical Tests</TextBlock>
                                <Grid Name="grdTests" HorizontalAlignment="Left" Margin="5,5,5,5">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="30"/>
                                        <RowDefinition Height="30"/>
                                        <RowDefinition Height="30"/>
                                        <RowDefinition Height="30"/>
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="60"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>

                                    <Rectangle Grid.Row="0" Grid.Column="1" Stroke="Black" Fill="{x:Static SystemColors.MenuHighlightBrush}"/>
                                    <Rectangle Grid.Row="0" Grid.Column="2" Stroke="Black" Fill="{x:Static SystemColors.MenuHighlightBrush}"/>

                                    <Rectangle Grid.Row="1" Grid.Column="0" Stroke="Black" Fill="{x:Static SystemColors.MenuHighlightBrush}"/>
                                    <Rectangle Grid.Row="1" Grid.Column="1" Stroke="Black"/>
                                    <Rectangle Grid.Row="1" Grid.Column="2" Stroke="Black"/>

                                    <Rectangle Grid.Row="2" Grid.Column="0" Stroke="Black" Fill="{x:Static SystemColors.MenuHighlightBrush}"/>
                                    <Rectangle Grid.Row="2" Grid.Column="1" Stroke="Black"/>
                                    <Rectangle Grid.Row="2" Grid.Column="2" Stroke="Black"/>

                                    <Rectangle Grid.Row="3" Grid.Column="0" Stroke="Black" Fill="{x:Static SystemColors.MenuHighlightBrush}"/>
                                    <Rectangle Grid.Row="3" Grid.Column="1" Stroke="Black"/>
                                    <Rectangle Grid.Row="3" Grid.Column="2" Stroke="Black"/>

                                    <TextBlock Grid.Row="0" FontWeight="Bold" Foreground="White" Margin="6, 0, 6, 0" VerticalAlignment="Center" HorizontalAlignment="Center"  Grid.Column="1" FontFamily="Pericles">
                            X<Run Typography.Variants="Superscript">2</Run>
                                    </TextBlock>
                                    <TextBlock FontWeight="Bold" Foreground="White" Margin="6, 0, 6, 0" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Row="0" Grid.Column="2" Text="2 Tailed P"/>

                                    <TextBlock FontWeight="Bold" Foreground="White" Margin="6, 0, 6, 0" VerticalAlignment="Center" Grid.Row="1" Grid.Column="0" Text="Uncorrected"/>
                                    <TextBlock FontWeight="Bold" Foreground="White" Margin="6, 0, 6, 0" VerticalAlignment="Center" Grid.Row="2" Grid.Column="0" Text="Mantel-Haenszel"/>
                                    <TextBlock FontWeight="Bold" Foreground="White" Margin="6, 0, 6, 0" VerticalAlignment="Center" Grid.Row="3" Grid.Column="0" Text="Corrected"/>

                                    <TextBlock Margin="6, 0, 6, 0" Name="txtChiSqUncVal" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="1" Grid.Column="1" />
                                    <TextBlock Margin="6, 0, 6, 0" Name="txtChiSqUncP" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="1" Grid.Column="2" />

                                    <TextBlock Margin="6, 0, 6, 0" Name="txtChiSqManVal" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="2" Grid.Column="1" />
                                    <TextBlock Margin="6, 0, 6, 0" Name="txtChiSqManP" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="2" Grid.Column="2" />

                                    <TextBlock Margin="6, 0, 6, 0" Name="txtChiSqCorVal" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="3" Grid.Column="1" />
                                    <TextBlock Margin="6, 0, 6, 0" Name="txtChiSqCorP" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="3" Grid.Column="2" />
                                </Grid>
                            </StackPanel>
                            <StackPanel>
                                <Grid Name="grd1PTests" HorizontalAlignment="Center"  Margin="5,5,5,5">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="30"/>
                                        <RowDefinition Height="30"/>
                                        <RowDefinition Height="30"/>
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>

                                    <Rectangle Grid.Row="0" Grid.Column="1" Stroke="Black" Fill="{x:Static SystemColors.MenuHighlightBrush}"/>
                                    <Rectangle Grid.Row="0" Grid.Column="2" Stroke="Black" Fill="{x:Static SystemColors.MenuHighlightBrush}"/>

                                    <Rectangle Grid.Row="1" Grid.Column="0" Stroke="Black" Fill="{x:Static SystemColors.MenuHighlightBrush}"/>
                                    <Rectangle Grid.Row="1" Grid.Column="1" Stroke="Black"/>
                                    <Rectangle Grid.Row="1" Grid.Column="2" Stroke="Black"/>

                                    <Rectangle Grid.Row="2" Grid.Column="0" Stroke="Black" Fill="{x:Static SystemColors.MenuHighlightBrush}"/>
                                    <Rectangle Grid.Row="2" Grid.Column="1" Stroke="Black"/>
                                    <Rectangle Grid.Row="2" Grid.Column="2" Stroke="Black"/>

                                    <Rectangle Grid.Row="3" Grid.Column="0" Stroke="Black" Fill="{x:Static SystemColors.MenuHighlightBrush}"/>
                                    <Rectangle Grid.Row="3" Grid.Column="1" Stroke="Black"/>
                                    <Rectangle Grid.Row="3" Grid.Column="2" Stroke="Black"/>

                                    <TextBlock FontWeight="Bold" Foreground="White" Margin="6, 2, 6, 2" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Row="0" Grid.Column="1" Text="1 Tailed P"/>
                                    <TextBlock FontWeight="Bold" Foreground="White" Margin="6, 2, 6, 2" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Row="0" Grid.Column="2" Text="2 Tailed P"/>

                                    <TextBlock Grid.Row="1" FontWeight="Bold" Foreground="White" Margin="6, 0, 6, 0" VerticalAlignment="Center" Grid.Column="0" Text="Mid-P Exact"/>
                                    <TextBlock Grid.Row="2" FontWeight="Bold" Foreground="White" Margin="6, 0, 6, 0" VerticalAlignment="Center" Grid.Column="0" Text="Fisher Exact"/>
                                    
                                    <TextBlock Margin="6, 0, 6, 0" Name="txtMidPExact" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="1" Grid.Column="1" />
                                    <TextBlock Margin="6, 0, 6, 0" Name="txtFisherExact" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="2" Grid.Column="1" />
                                    <TextBlock Margin="6, 0, 6, 0" Name="txtFisherExact2P" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="2" Grid.Column="2" />
                                </Grid>
                            </StackPanel>
                        </StackPanel>
                    </StackPanel>
                </StackPanel>
                
                <StackPanel x:Name="pnlCrosstabContent">
                    <Grid Name="grdTable" Width="Auto" HorizontalAlignment="Center" Margin="0,52,0,0" Visibility="Collapsed">                        
                    </Grid>
                </StackPanel>
                
                <StackPanel Orientation="Vertical" Margin="10,-10,-10,0" HorizontalAlignment="Right" VerticalAlignment="Top" >
                    <Grid x:Name="ConfigGrid" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,10,10,0" >
                        <Path x:Name="ConfigCollapsedTriangle" Canvas.ZIndex="100" Height="10" HorizontalAlignment="Right" Margin="0,19,15.375,0" VerticalAlignment="Top" Width="10" Fill="#995C90B2"
                  Stretch="Fill" Stroke="#FF666666" Data="M85,25 L85,25 L87.5,30 L90,25 z" RenderTransformOrigin="3.083,-1.417" Visibility="Collapsed"
                  StrokeThickness="0"/>
                        <Path x:Name="ConfigExpandedTriangle" Canvas.ZIndex="100" Height="10" HorizontalAlignment="Right" Margin="0,16.931,15.294,0" VerticalAlignment="Top" Width="10" Stretch="Fill"
                  Stroke="#FF666666" Data="M85,30 L85,30 L87.5,25 L90,30 z" RenderTransformOrigin="3.083,-1.417" Fill="#995C90B2"
                  StrokeThickness="0"/>
                        <Rectangle Fill="#22000000" RadiusX="10" RadiusY="10" Margin="0,4,0,0" />
                        <Rectangle Fill="#775C90B2" Stroke="Gray"  RadiusX="10" RadiusY="10" Margin="0,0,0,5" />
                        <Rectangle Fill="#DDFFFFFF" Stroke="DarkGray" RadiusX="5" RadiusY="5" Margin="10,10,10,15" />
                        <TextBlock x:Name="ConfigCollapsedTitle" TextAlignment="Center" Text="Crosstab Properties" Margin="30.331,15.069,29.669,0" FontWeight="Bold"
                       Height="16" VerticalAlignment="Top" RenderTransformOrigin="0.501,1.017" Visibility="Collapsed" />
                        <StackPanel Orientation="Vertical" Margin="25" HorizontalAlignment="Center" VerticalAlignment="Top" >
                            <TextBlock HorizontalAlignment="Center" TextAlignment="Center" Text="Crosstab Properties" Margin="5" FontWeight="Bold" />
                            <TextBlock HorizontalAlignment="Left" TextAlignment="Center" Text="Exposure Field:" Margin="0,5,0,0"  />
                            <ComboBox x:Name="cbxExposureField" HorizontalAlignment="Left" SelectedIndex="0" Width="140" />
                            <TextBlock HorizontalAlignment="Left" TextAlignment="Center" Text="Outcome Field:" Margin="0,5,0,0"  />
                            <ComboBox x:Name="cbxOutcomeField" HorizontalAlignment="Left" SelectedIndex="0" Width="140" />

                            <Grid x:Name="grdAdvancedOptionsHeading">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                                </Grid.ColumnDefinitions>
                                <Path x:Name="AdvCollapsedTriangle" Grid.Column="1" Canvas.ZIndex="100" Height="10" HorizontalAlignment="Right" Margin="0,19,15.375,0" VerticalAlignment="Top" Width="10" Fill="#995C90B2"
                  Stretch="Fill" Stroke="#FF666666" Data="M85,25 L85,25 L87.5,30 L90,25 z" RenderTransformOrigin="3.083,-1.417" Visibility="Visible"
                  StrokeThickness="0"/>
                                <Path x:Name="AdvExpandedTriangle" Grid.Column="1" Canvas.ZIndex="100" Height="10" HorizontalAlignment="Right" Margin="0,16.931,15.294,0" VerticalAlignment="Top" Width="10" Stretch="Fill"
                  Stroke="#FF666666" Data="M85,30 L85,30 L87.5,25 L90,30 z" RenderTransformOrigin="3.083,-1.417" Fill="#995C90B2" Visibility="Collapsed"
                  StrokeThickness="0"/>
                                <TextBlock x:Name="tblockAdvancedOptions" Grid.Column="0" HorizontalAlignment="Left" TextAlignment="Center" Text="Advanced options " Margin="0,15,0,5"  />
                            </Grid>

                            <StackPanel x:Name="panelAdvanced" Visibility="Collapsed">

                                <CheckBox x:Name="checkboxShowPercents" Margin="0,5,0,0" Content="Show percents" IsChecked="True" HorizontalAlignment="Left" />
                                <CheckBox x:Name="checkboxSmartTable" Margin="0,5,0,0" Content="Smart table" IsChecked="False" HorizontalAlignment="Left" />
                                
                            </StackPanel>

                        </StackPanel>
                    </Grid>
                </StackPanel>
            </Grid>
        </GroupBox>
        <Image x:Name="imgClose" Source="Images\x.png" HorizontalAlignment="Right" VerticalAlignment="Top"/>
    </Grid>
</UserControl>
